//
//  NSArray+FileData.m
//  XYTest
//
//  Created by yao zhaofeng on 2018/4/19.
//  Copyright © 2018年 YaoZhaofeng. All rights reserved.
//

#import "NSArray+FileData.h"

@implementation NSArray (FileData)

- (BOOL)saveToFileURL:(NSURL *)url {
    BOOL result = NO;
    if (@available(iOS 11.0, *)) {
        NSError *error = nil;
        result = [self writeToURL:url error:&error];
        if (error) {
            NSLog(@"saveToFileURL::%@  failed with error::%@", url, error);
        }
    } else {
        // Fallback on earlier versions
        result = [self writeToURL:url atomically:YES];
    }
    
    return result;
}

@end
